package ao

import (
	"context"
	pb "gitee.com/micro-services/protocol/user/api"
	spb "gitee.com/micro-services/protocol/user/server"
	"micro.user.client/integration"
)

func CreateUser(ctx context.Context, r *pb.APICreateUserReq, w *pb.APICreateUserRsp) error {
	rsp, err := integration.GetProxyManger().UserServiceProxy.CreateUser(ctx, &spb.CreateUserReq{
		UserName: r.UserName,
		PassWord: r.PassWord,
		Phone:    r.Phone,
		Email:    r.Email,
		HotelID:  r.HotelID,
	})
	if err != nil {
		return err
	}

	w.RetCode = rsp.GetRetCode()
	w.Msg = rsp.GetMsg()
	return nil
}
